﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Imagine
{
    //Creation of RenderLayers should be handled by the Engine internally, i dont want to give that control to the user
    //If user wants to create a render layer let him just add the name into Enum, I will fucking do the rest
    public class RenderLayer
    {
        public RenderLayer(GraphicsDevice _device) 
        {
            Device = _device;
            Transformation = Matrix.Identity;
            ParallaxFactor = 1.0f;
            Blend = BlendState.AlphaBlend;  
            //ShaderEffect = new Effect(_device, null);
        }
        //We will need to apply effects/transfortmations here
        public void BeginRendering(SpriteBatch _spriteBatch, Matrix transformation)
        {
            _spriteBatch.Begin(SpriteSortMode.BackToFront, Blend, SamplerState.AnisotropicClamp, Device.DepthStencilState,RasterizerState.CullCounterClockwise, (ShaderEffect != null ? ShaderEffect : null) ,transformation);
        }
        public void EndRendering(SpriteBatch _spriteBatch)           
        {
            _spriteBatch.End();
        }
        public void SetUpTransformation()    {}
        //Can contain Effect or transformation that will be applied to all child actors
        
        GraphicsDevice      Device;
        public Matrix       Transformation;               //layer specific transformation, if any
        public float        ParallaxFactor;               //Parallax factor, speed for the layer
        public BlendState   Blend;
        public Effect       ShaderEffect;
    }

}
